using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace AllIsWell.Core.Models
{
    public class Page : IModel, IValidatableObject
    {
        public int Id { get; set; }

        public DateTime DateTime { get; set; }

        [Required(ErrorMessage = "Destiny is required")]
        public Destiny Destiny { get; set; }

        public virtual List<Retrospect> Retrospects { get; set; }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (DateTime == new DateTime())
            {
                yield return new ValidationResult("Date is requried");
            }

            if (DateTime != DateTime.Today)
            {
                yield return new ValidationResult("DateTime should not be a past/future date");
            }
        }
    }
}